from selenium import webdriver
import time

from selenium.webdriver.common.by import By

wd = webdriver.Chrome()
wd.get("http://172.16.60.30/#/login")
# js = "window.open('http://fanyi.youdao.com/')"
# wd.execute_script(js)

wd.implicitly_wait(10)
wd.maximize_window()

wd.find_element_by_xpath('//div[@class="_2uQzV"]').click()

# wd.find_element_by_xpath("//../span[text() = '用户中心登录']").click()

# 输入邮箱
wd.find_element_by_xpath("//input[@placeholder= '邮箱']").send_keys("admin@forensix.cn")

# 输入密码
wd.find_element_by_xpath("//input[@placeholder = '密码']").send_keys("123456")

# 点击“授权并登录”按钮
wd.find_element_by_xpath("//span[text() = '授权并登录']").click()

# 搜索框
wd.find_element_by_xpath('//input[@placeholder="请输入关键词"]').send_keys("20200918130701")

wd.find_element(By.XPATH, '//span[@title="20200918130701"]').click()

# 切换windows

handles = wd.window_handles

for h in handles:
    wd.switch_to.window(h)
    if "20201318130938G" in wd.title:
        print(wd.title)
        break
else:
    print("没有打开对应页面")


wd.find_element(By.XPATH, '//span[text()="确定"]/..').click()


eles = wd.find_elements(By.XPATH, '//div[@class="v-card__title pt-1 subtitle-1"]')
for ele in eles:
    ele.click()

time.sleep(10)
wd.quit()

